<template>
  <div class="screen-full">
    <!-- 下面的图标是我们项目里面定义的svg组件，是一种矢量图标 -->
    <!-- 也可以使用element-ui提供的字体图标，两种方式都可以 -->
    <!-- <i class="el-icon-cold-drink" /> -->
    <svg-icon :icon-class="isFull ? 'eye-open' : 'eye'" @click="toggleFullScreen" />
  </div>
</template>

<script>
import screenfull from 'screenfull'
export default {
  name: '',
  data() {
    return {
      isFull: false
    }
  },
  created() {
    screenfull.on('change', () => {
      console.log(111, screenfull.isFullscreen)
      this.isFull = screenfull.isFullscreen
    })
  },
  methods: {
    toggleFullScreen() {
      // 只有200行，一定要说我看过一些包的源码 --- 当前项目里面node_modules文件夹 --- 工资
      screenfull.toggle()
      this.isFull = !this.isFull
    }
  }
}
</script>

<style lang="scss" scoped>
.screen-full {
  display: inline-block;
  color: #ed6e6e;
  margin-right: 15px;
}
</style>
